package com.atguigu.gulimall.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import sun.security.krb5.KrbException;

/**
 * @description:
 * @author: BlueSky
 * @create: 2021-10-13 11:16
 **/

@Configuration
public class MyRedissonConfig {
	/**
	 * 所有对Redisson的使用都是通过RedissonClient对象
	 */
	@Bean(destroyMethod = "shutdown")
	public RedissonClient redisson() throws KrbException {
		//1、创建配置
		Config config = new Config();
		config.useSingleServer().setAddress("redis://192.168.56.10:6379");
		//2、根据Config创建出RedissonClient示例
		RedissonClient redissonClient = Redisson.create(config);
		return redissonClient;
	}
}
